<!DOCTYPE html>
<!-- 
Template Name: Metronic - Responsive Admin Dashboard Template build with Twitter Bootstrap 3.1.1
Version: 2.0.2
Author: KeenThemes
Website: http://www.keenthemes.com/
Contact: support@keenthemes.com
Purchase: http://themeforest.net/item/metronic-responsive-admin-dashboard-template/4021469?ref=keenthemes
License: You must have a valid license purchased only from themeforest(the above link) in order to legally use the theme for your project.
-->
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en" class="no-js" ng-app="loginApp">
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8" />
<title>用户与结算中心</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="" name="description" />
<meta content="" name="author" />
<!-- BEGIN GLOBAL MANDATORY STYLES -->

<link href="manageView/assets/plugins/font-awesome/css/font-awesome.min.css"
	rel="stylesheet" type="text/css" />
<link href="manageView/assets/plugins/bootstrap/css/bootstrap.min.css"
	rel="stylesheet" type="text/css" />
<link href="manageView/assets/plugins/uniform/css/uniform.default.css"
	rel="stylesheet" type="text/css" />
<!-- END GLOBAL MANDATORY STYLES -->
<!-- BEGIN THEME STYLES -->
<link href="manageView/assets/css/style-metronic.css" rel="stylesheet"
	type="text/css" />
<link href="manageView/assets/css/style.css" rel="stylesheet"
	type="text/css" />
<link href="manageView/assets/css/style-responsive.css" rel="stylesheet"
	type="text/css" />
<link href="manageView/assets/css/themes/default.css" rel="stylesheet"
	type="text/css" id="style_color" />
<link href="manageView/assets/css/pages/login.css" rel="stylesheet"
	type="text/css" />
<link href="manageView/assets/css/public.css" rel="stylesheet"
	type="text/css" />
<!-- END THEME STYLES -->
<link rel="shortcut icon" href="manageView/assets/favicon.ico"
	type="image/x-icon">
</head>
<!-- BEGIN BODY -->
<body class="login" ng-controller="loginController">
	<!-- BEGIN LOGO -->
	<!--<div class="logo">
	<div class="content" style="padding-bottom: 0px; padding-top: 40px;">
		<a href="index.html">
			<img src="manageView/assets/img/logo.png" alt="" height="50px"/>
		</a>
	</div>
</div>-->
	<!-- END LOGO -->
	<!-- BEGIN LOGIN -->
	<div class="login_box">
		<p class="login-logo"><img src="/manageView/assets/img/login-logo.png"></p>
		<div class="content">
			<!-- BEGIN LOGIN FORM -->
			<div class="login-form" id="loginFrom">
				<h3 class="form-title">用户与结算中心</h3>
				<div class="form-group">
					<input ng-model="username"
							class="form-control placeholder-no-fix bValidate" key="required"
							type="text" autocomplete="off" placeholder="手机/用户名/邮件"
							name="username" id="username" />
				</div>
				<div class="form-group">
					<input ng-model="password"
							class="form-control placeholder-no-fix bValidate" key="required"
							type="password" autocomplete="off" placeholder="密码"
							name="password" id="password" />
				</div>
				<div class="alert-danger hidden" role="alert" id="loginMsg"
					ng-bind="msg"></div>
				<div class="form-actions">
					<a ng-click="forgetPassword(username);" href="javascript:;">忘记密码?</a>
					<div>
						<button type="submit" class="btn blue pull-right login-btn"
							ng-click="login();">登陆</button>
					</div>

				</div>
			</div>
			<!-- END LOGIN FORM -->
		</div>
		<p class="copyright">Copyright © 2017 haote.online All Rights Reserved 四川豪特新能源有限公司 版权所有</p>
	</div>
	<div id="changePasswordModel" class="modal fade" role="dialog"
		aria-hidden="true" data-backdrop="false">
		<div class="modal-dialog">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" data-dismiss="modal"
						aria-hidden="true">×</button>
					<h4 class="modal-title">忘记密码</h4>
				</div>
				<div class="modal-body form">
					<div class="form-group">
						<div class="row">
							<label class="col-sm-4 control-label text-right">手机号码</label>
							<div class="col-sm-8">
								<div class="input-group">
									<input type="text" class="form-control" ng-model="moboleNo"/>
										<!-- ng-disabled="true"  -->
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-4 control-label text-right">短信验证码</label>
							<div class="col-sm-4">
								<div class="input-group">
									<input type="text" class="form-control" ng-model="verifyCode" />
								</div>
							</div>
							<div class="col-sm-4">
								<div class="input-group">
									<a class="btn " href="javascript:;" ng-click="sendMessage();">获取短信验证码</a>

								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-4 control-label text-right">输入新密码</label>
							<div class="col-sm-8">
								<div class="input-group">
									<input class="form-control" ng-model="newPassword"
										key="required" type="password" autocomplete="off" />
								</div>
							</div>
						</div>
						<div class="row">
							<label class="col-sm-4 control-label text-right">确认输新密码</label>
							<div class="col-sm-8">
								<div class="input-group">
									<input class="form-control" ng-model="confirmPassword"
										key="required" type="password" autocomplete="off" />
								</div>
							</div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-danger" data-dismiss="modal">
								<i class="fa fa-times"></i>关闭
							</button>
							<button type="button" class="btn btn-primary"
								ng-click="saveChangePassword();">
								<i class="fa fa-check"></i>保存
							</button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!-- END LOGIN -->
	<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
	<!-- BEGIN CORE PLUGINS -->
	<!--[if lt IE 9]>
	<script src="manageView/assets/plugins/respond.min.js"></script>
	<script src="manageView/assets/plugins/excanvas.min.js"></script> 
	<![endif]-->
	<script src="manageView/assets/plugins/jquery-1.10.2.min.js"
		type="text/javascript"></script>
	<script src="manageView/assets/plugins/jquery-migrate-1.2.1.min.js"
		type="text/javascript"></script>
	<script src="manageView/assets/plugins/bootstrap/js/bootstrap.min.js"
		type="text/javascript"></script>
	<script
		src="manageView/assets/plugins/bootstrap-hover-dropdown/bootstrap-hover-dropdown.min.js"
		type="text/javascript"></script>
	<script
		src="manageView/assets/plugins/jquery-slimscroll/jquery.slimscroll.min.js"
		type="text/javascript"></script>
	<script src="manageView/assets/plugins/jquery.blockui.min.js"
		type="text/javascript"></script>
	<script src="manageView/assets/plugins/jquery.cokie.min.js"
		type="text/javascript"></script>
	<script src="manageView/assets/plugins/uniform/jquery.uniform.min.js"
		type="text/javascript"></script>
	<!-- END CORE PLUGINS -->
	<!-- BEGIN PAGE LEVEL SCRIPTS -->
	<script src="manageView/assets/scripts/core/app.js" type="text/javascript"></script>
	<script type="text/javascript"
		src="manageView/assets/scripts/angular/angular.js"></script>
	<script src="manageView/assets/scripts/bValidate.js" type="text/javascript"></script>
	<!-- END PAGE LEVEL SCRIPTS -->

	<script>
jQuery(document).ready(function() {     
	App.init();
});	
var login = angular.module("loginApp", []);
login.controller("loginController", function ($scope, $http) {
	$scope.login = function() {
		if(bValidateObj.bValidateCall($('#loginFrom'))){
			var postData = $.param({
    			username: $scope.username,
    			password: $scope.password
    		});
    		var url = "login";
    		$http({
				method: 'POST',
				url: url,
				data: postData,
				headers: {
					'Content-Type': 'application/x-www-form-urlencoded'
				},
				cache: false
			}).success(function(data) {
				if(data.isSuccess){
					window.location.reload();
				}else{
					$scope.msg = data.msg;
					$('#loginMsg').removeClass('hidden');
				}
			});
		}
	}
	var moboleNoRegex = /^(\+86)?(1[34578][0-9]{9})$/;
	$scope.forgetPassword=function(username){//忘记密码
		if(!!!username){
		alert("请输入用户名！")
		return false;
		}
		if(username.match(moboleNoRegex)){
			$scope.moboleNo=username;
		} else{
			$scope.moboleNo = "";
		}
		$("#changePasswordModel").modal('show');
	}
	$scope.sendMessage=function(){//发送短信
		if(!$scope.moboleNo.match(moboleNoRegex)){
			alert("请输入正确的手机号！")
			return false;
		}
		var postData = $.param({
			moboleNo: $scope.moboleNo 
		});
		var url = "sendModifyPasswordVerifyCode";
		$http({
			method: 'POST',
			url: url,
			data: postData,
			headers: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			cache: false
		}).success(function(data) {
			if("success"==data.requestStatus){
				alert("发送成功！");
			}else{
				alert(data.requestResult);
			}
		});
	}
	$scope.saveChangePassword=function(){//保存忘记密码
		var postData = $.param({
			moboleNo: $scope.moboleNo,
			verifyCode: $scope.verifyCode,
			newPassword: $scope.newPassword,
			confirmPassword: $scope.confirmPassword
		});
		if(!$scope.moboleNo.match(moboleNoRegex)){
			alert("请输入正确的手机号！")
			return false;
		}
		if(!!!$scope.verifyCode){
			alert("短信验证码不能够为空！")
			return false;
			}
		if(!!!$scope.newPassword){
			alert("密码不能够为空！")
			return false;
			}
		if(!!!$scope.confirmPassword){
			alert("确认密码不能够为空！")
			return false;
			}
		if($scope.newPassword!=$scope.confirmPassword){
			alert("两次输入密码不致！")
			return false;
			}
		console.log("12321");
		if($scope.newPassword.length < 6 || $scope.newPassword.length > 30){
			alert("密码长度6-30位！")
			return false;
			}
		var url = "modifyPassword";
		$http({
			method: 'POST',
			url: url,
			data: postData,
			headers: {
				'Content-Type': 'application/x-www-form-urlencoded'
			},
			cache: false
		}).success(function(data) { 
			if(data.requestStatus=="success"){
				$("#changePasswordModel").modal('hide');
				$scope.moboleNo = "";
				$scope.verifyCode = "";
				$scope.newPassword = "";
				$scope.confirmPassword = "";
				alert("修改成功！");
			}else{
				alert(data.requestResult['errorMsg']);
			}
		});
	}
	$(document).on('keypress',function (event){
		var e = event || window.event || arguments.callee.caller.arguments[0];
		if(e && e.keyCode == 13){//回车
			$scope.login();
		}
	});
});
</script>
	<!-- END JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>